package com.wtone.platform.gat.images.gat.controller;


import com.wtone.platform.gat.images.gat.core.BaseController;
import com.wtone.platform.gat.images.gat.core.R;
import com.wtone.platform.gat.images.gat.entity.Apedb;
import com.wtone.platform.gat.images.gat.service.IApedbService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author aiLin
 * @date 2020-10-07
 * @desc:采集设备对象 提供者
 */
@Api(tags = "采集设备DB", value = "Apedb api")
@RestController
@RequestMapping("apedb")
public class ApedbController extends BaseController
{

	@Autowired
	private IApedbService apedbService;

	@ApiOperation(value = "根据卡片id查询采集设备对象信息" , position = 10)
	@GetMapping("get/{id}")
	public Apedb get(@PathVariable("id") String id){
		return apedbService.selectApedbById(id);
	}

	@ApiOperation(value = "查询采集设备对象列表", position = 10)
	@ApiResponses(value = {
			@ApiResponse(code = 200, message="List结果集",response= Apedb.class),
			@ApiResponse(code = 404, message = "not found error")
	})
	@ApiImplicitParam(name = "params", value = "请求参数", required = false, paramType="path", dataType = "MAP")
	@GetMapping("list")
	public R list(Apedb apedb){
		startPage();
		return result(apedbService.selectApedbList(apedb));
	}

	@ApiOperation(value = "新增采集设备对象", position = 1)
	@PostMapping("save")
	public R addSave(@RequestBody Apedb apedb){
		return toAjax(apedbService.insertApedb(apedb));
	}


	@ApiOperation(value = "修改采集设备对象", position = 2)
	@PostMapping("update")
	public R editSave(@RequestBody Apedb apedb){
		return toAjax(apedbService.updateApedb(apedb));
	}


	@ApiOperation(value = "根据卡片id删除采集设备对象", position = 3)
	@PostMapping("remove")
	public R remove(String ids)
	{
		return toAjax(apedbService.deleteApedbByIds(ids));
	}

}
